package edu.gatech.gro.model;

import java.util.List;

import android.content.Context;
import edu.gatech.gro.model.dao.NamedListDao;
import edu.gatech.gro.utils.Utils;

public class User extends AbstractObject {

	/* Attributes matching exactly the database model. */
	private String username;
	private String usernameClean;
	private String email;
	private String password;

	private List<NamedList> lists;

	public User() {
		super();
	}

	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
		this.setUsernameClean(Utils.cleanName(username));
	}

	public String getUsernameClean() {
		return usernameClean;
	}

	public void setUsernameClean(String usernameClean) {
		this.usernameClean = usernameClean;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public List<NamedList> getLists(Context ctx) {
		if (lists == null && ctx != null) {
			NamedListDao dao = new NamedListDao(ctx);
			lists = dao.getAllNamedLists(id);
		}
		return lists;
	}

	public List<NamedList> getLists() {
		return lists;
	}

	public void setLists(List<NamedList> lists) {
		this.lists = lists;
	}
}
